package tragame.game;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import tragame.interfaces.IResource;

/**
 * This class is a representation of a square in a field. It represents a forest,
 * a mine or any other place where a type of basic resource (wood, soil, iron,
 * food) can be collected.
 * Therefore a limit has been created (maxProd) that represents the amount of basic
 * resource that a worker could get before the resource disappears
 * @author jing jing
 *
 */

public class Resource extends UnicastRemoteObject implements IResource{

	private static final long serialVersionUID = 1L;
	
	private int production;
	private ResourceType type;
	public enum ResourceType {bois, terre, fer, nourriture}	
	
	/**
	 * constructor with parameter : builds a resource of a given type
	 * @param type : type of the resource
	 */
	
	public Resource(ResourceType type) throws RemoteException{
		switch(type) {
			case bois:
				this.production = 0;
				break;
			case terre:
				this.production = 0;
				break;
			case fer:
				this.production = 0;
				break;
			default:
				this.production = 0;
		}
		this.type = type;
	}
	
	public ResourceType getType(){
		return this.type;
	}
	
	public int getProduction(){
		return this.production;
	}
	
	public void setProduction(int production){
		this.production = production;
	}
}
